﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using AliFox.BaseService.Controllers;
using AliFox.BaseService.Systems.MenuManagement;
using AliFox.BaseService.Systems.MenuManagement.Dto;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Dtos;

namespace AliFox.BaseService.HttpApi.Systems;

[Area("base")]
[Route("api/base/menu")]
public class MenuController(IMenuAppService menuAppService) : BaseServiceController, IMenuAppService
{
    [HttpPost]
    public Task<MenuDto> Create(CreateOrUpdateMenuDto input)
    {
        return menuAppService.Create(input);
    }

    [HttpPost]
    [Route("delete")]
    public Task Delete(List<Guid> ids)
    {
        return menuAppService.Delete(ids);
    }

    [HttpGet]
    [Route("{id}")]
    public Task<MenuDto> Get(Guid id)
    {
        return menuAppService.Get(id);
    }

    [HttpGet]
    [Route("all")]
    public Task<ListResultDto<MenuDto>> GetAll(GetMenuInputDto input)
    {
        var res = menuAppService.GetAll(input);
        return res;
    }

    [HttpGet]
    [Route("loadMenus")]
    public Task<ListResultDto<MenuDto>> LoadAll(Guid? id)
    {
        return menuAppService.LoadAll(id);
    }

    [HttpPut]
    [Route("{id}")]
    public Task<MenuDto> Update(Guid id, CreateOrUpdateMenuDto input)
    {
        return menuAppService.Update(id, input);
    }
}
